var http = require('http');
 
var url = ('ajax.googleapis.com')
var google = http.createClient(80, url);
 
var text = "Hello World from node!";
var requestUrl = '/ajax/services/language/translate?v=1.0&q=' + 
                 escape(text) + '&langpair=en%7Cfr'
var request = google.request('GET', requestUrl, 
              {"host": "ajax.googleapis.com"});
request.end();
 
request.addListener('response', function (response) {
  	var body = '';
 
	response.addListener('data', function (chunk) {
		body += chunk;
    });
 
    response.addListener("end", function() {
        var jsonData = JSON.parse(body);
	    console.log(jsonData.responseData.translatedText);
    })
 
});
